home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-04 | 3.7 KB | 109 lines | [TEXT/CWIE] |
- // MADE - Macintosh Application Development Essentials
- // ---------------------------------------------------
-
- // (c) Gideon Greenspan, Sig Software - June 1997 - http://www.kagi.com/gdg/
-
- // These files can only be used for experimental standalone purposes. To obtain
- // fully commented code, and licenses for standalone, shareware, internal and
- // commercial usage, run the enclosed Register application.
-
- // Essential Headers.h
- //
- // A header file containing all prototypes and global variables for the MADE package.
- //
- // Version 1.0.0 - 10th November 1996
-
- #include "Essential Settings.h"
-
- typedef OSErr Error;
-
- void* AllocPtr(Error* error, Size allocate);
- // try to create non-movable memory block
- void** AllocHandle(Error* error, Size allocate);
- // try to create movable memory block
- void DestroyPtr(void* pointer);
- // destroy non-movable memory block
- void DestroyHandle(void** handle);
- // destroy movable memory block
-
- #if Project_Under_Development
-
- void HandleAssertFailure(char* file, char* date, int line); // params shown in dialog
-
- #define Assert(test) { if (!(test)) HandleAssertFailure(__FILE__, __DATE__, __LINE__); }
- // calls failure handler with necessary parameters if text fails
- // NOTE : If Pool Strings is off under CodeWarrior C/C++ this will cause
- // unnecessary code expansion because of all the file names and dates.
-
- // Whenever locking or unlocking handlers, use LockHandle and UnlockHandle, not the
- // system calls HLock and HUnlock. This will let you use locking assertion later.
-
- #else
-
- #define Assert(test) ;
-
- #endif
-
- #if Project_Under_Development && Assert_Memory_Locking
-
- void LockHandleAssert(void** handle);
- void UnlockHandleAssert(void** handle);
-
- #define LockHandle(handle) LockHandleAssert(handle) // checks status is changed
- #define UnlockHandle(handle) UnlockHandleAssert(handle) // checks status is changed
-
- #else
-
- #define LockHandle(handle) HLock((Handle)(handle)) // calls normal Mac Toolbox
- #define UnlockHandle(handle) HUnlock((Handle)(handle)) // calls normal Mac Toolbox
-
- #endif
-
- #define AssertRange(test, minimum, maximum) Assert((test>=minimum)&&(test<=maximum));
- // Asserts test is within minimum and maximum values
-
- void TestError(Error error);
- // displays relevant error dialog if error is non-zero
- Error TestResError(void* resource);
- // checks for zero resource handle, ResError, shows dialog and returns error code
- Error TestMemError(void* pointer);
- // checks for zero pointer, MemError, shows dialog and returns error code
-
- // Useful miniature labels for catching error conditions five levels deep
-
- #define _e failed:;
- #define _e2 failed2:;
- #define _e3 failed3:;
- #define _e4 failed4:;
- #define _e5 failed5:;
-
- #define _g goto failed;
- #define _g2 goto failed2;
- #define _g3 goto failed3;
- #define _g4 goto failed4;
- #define _g5 goto failed5;
-
- #define _i(param) { if (param) _g }
- #define _i2(param) { if (param) _g2 }
- #define _i3(param) { if (param) _g3 }
- #define _i4(param) { if (param) _g4 }
- #define _i5(param) { if (param) _g5 }
-
- extern Boolean applicationHasQuit; // set high to end event loop
- extern void* dummy; // used for discarding unwanted results
- extern WindowPtr frontWindow; // which Window is in front of the rest
-
- Boolean CheckGestaltBit(OSType selector, char bit); // for determining environment
- void ShowResCursor(short cursorID); // loads cursor from resource and displays
-
- #if Use_Drag_Manager
-
- void CreateDragRegion(RgnHandle region);
- // Turns the given region in local co-ordinates into a drag frame region in
- // global co-ordinates, using the current active GrafPort. This is very
- // useful for initialising drags with TrackDrag().
-
- #endif
-
- #define System_Software_Version_Error 1996 // used when needed OS is missing
-